package org.call.hi;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

@FeignClient(name = "service-hi", fallback = IServerHi.ServiceBClientFallback.class)
public interface IServerHi {

	     @GetMapping(value = "/hi")
	    String indexHI();
	 
	 
	    @Component
	    class ServiceBClientFallback implements IServerHi {

	        private static final Logger LOGGER = LoggerFactory.getLogger(ServiceBClientFallback.class);

	        @Override
	        public String indexHI() {
	            LOGGER.info("异常发生，进入fallback方法");
	            return "SERVICE B FAILED! - FALLING BACK";
	        }
	    }
}
